package com.hidt.shop.service.impl;

import com.hidt.shop.domain.Admin;
import com.hidt.shop.mapper.AdminMapper;
import com.hidt.shop.service.AdminService;
import com.hidt.shop.util.SafeUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class AdminServiceImpl implements AdminService {
    @Autowired
    private AdminMapper adminMapper;
    @Override
    public int AdminLogin(String admin_name, String admin_pwd) {
        Admin adm =adminMapper.AdminLogin(admin_name);
        if(adm == null){
            return 0;
        }if(adm.getAdmin_pwd().equals(SafeUtil.encode(admin_pwd))){
            return 2;
        }
        return 1;
    }
}
